Certificate format convert

75 views
Skip to first unread message

饼小干

unread,
Apr 23, 2025, 3:51:28 PMApr 23
to dev-pl...@mozilla.org
Does Firefoxe browser involve format conversion when importing or exporting digital certificates, such as importing local DER format certificates into PEM format or exporting browser DER format certificates into PEM format? If so, could you please tell me how to perform such format conversions accurately?  

Dana Keeler

unread,
Apr 23, 2025, 11:38:28 PMApr 23
to 饼小干, dev-pl...@mozilla.org
Firefox can import DER or PEM certificates in the certificate manager. In the certificate viewer, Firefox exports PEM.
What is it you're trying to do? If you just want to convert PEM to DER or vice-versa, something like openssl (or even a base64 encoder/decoder) would probably be easier to use.

On Wed, Apr 23, 2025 at 3:21 AM 饼小干 <bingxi...@gmail.com> wrote:
Does Firefoxe browser involve format conversion when importing or exporting digital certificates, such as importing local DER format certificates into PEM format or exporting browser DER format certificates into PEM format? If so, could you please tell me how to perform such format conversions accurately?  

--
You received this message because you are subscribed to the Google Groups "dev-pl...@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dev-platform...@mozilla.org.
To view this discussion visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/09cab96a-f65d-4fbb-9b7a-564b87897cdan%40mozilla.org.

饼小干

unread,
Apr 24, 2025, 6:03:51 PMApr 24
to dev-pl...@mozilla.org, dke...@mozilla.com, dev-pl...@mozilla.org, 饼小干

Thank you for your response. I would like to understand how Firefox handles format conversion.
As you mentioned, PEM certificates can be exported from the viewer. So, when viewing a DER format certificate, how does Firefox perform the format conversion when exporting it to PEM? Similarly, when importing a certificate into the certificate manager, is it possible to import a DER certificate in PEM format? If so, how is this format conversion implemented?

Dana Keeler

unread,
Apr 25, 2025, 12:00:58 AMApr 25
to 饼小干, dev-pl...@mozilla.org
Generally speaking, certificates are represented internally as DER in Firefox. PEM is just base64-encoded DER with line breaks and a "-----BEGIN CERTIFICATE-----"/"-----END CERTIFICATE-----" header/footer. When importing a certificate, if it's PEM, Firefox will decode it by stripping out the header and footer and converting the base64 to the original DER. When exporting a certificate as PEM, Firefox will convert the DER to base64 and add line breaks and the header and footer.

饼小干

unread,
Apr 25, 2025, 4:44:29 PMApr 25
to dev-pl...@mozilla.org, dke...@mozilla.com, dev-pl...@mozilla.org, 饼小干
I see, thanks for your reply.
Reply all
Reply to author
Forward
0 new messages